Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

263
Views
Receiving an [object HTMLInputElement] error when trying to convert characters

I have the following code for which I am trying to convert input entered by a user to replace certain characters (e with a 3 and t with a 7) but instead, I am getting a [object HTMLInputElement] error in my output.

function ReplaceChars() {

  var json = JSON.parse(localStorage.getItem("registration"));
  var characters = json['charsEntered'];
  var percentage = "";
  var total = "";

  result = characters
    .replaceAll(/e|E/g, "3")
    .replaceAll(/t|T/g, "7")

  total = characters.length;

  if (result.match(/e|E|t|T/g) == null) {

    roundedPercentage = 0.00;
    result = charsEntered;
  } else {

    percentage = ((characters.match(/e|E|t|T/g).length) / total) * 100
    roundedPercentage = percentage.toFixed(2);
  }

  console.log(result);

  $("#charsConverted").val(result);
  $("#percentage").val(roundedPercentage + "%");

}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!